<?php
/**
 * Created by JetBrains PhpStorm.
 * User: dung
 * Date: 2/19/14
 * Time: 2:37 AM
 * To change this template use File | Settings | File Templates.
 */
?>
<?php
if(isset($_SESSION["users_id"]) && $_SESSION["group_id"]==1){
    $id=$_GET["recruitment_id"];
    $recruitment=RecruitmentDetail($id);
    $row_recruitment=mysql_fetch_array($recruitment);
    if(isset($_POST["btnAdd"]))
    {
        $title=$_POST["title"];
        date_default_timezone_set('Asia/Ho_Chi_Minh');
        $datepicker=date('Y-m-d H:i:m');
        $user_id=$_POST["IDUser"];settype($user_id,"int");
        $language_id=$_POST["language"];settype($language_id,"int");
        $detail=$_POST["Content"];
        $AnHien=$_POST["AnHien"];settype($AnHien,"int");
        EditRecruitment($id,$title,$detail,$datepicker,$AnHien,$language_id,$user_id);
        header("location:index.php?p=employeelist");
    }
?>
<form id="maincp" name="form1" method="post" action="">
    <h1 class="h1">Add Employee</h1>
    <p>Please complete all form below to add a new article.</p>
    <ul class="list2">
        <li><h3>Title</h3></li>
        <li><input value="<?php echo $row_recruitment['title']; ?>" class="input" type="text" name="title" id="title" /></li>
        <li><h3>Info</h3></li>
        <li><textarea class="ckeditor" name="Content" id="Content" cols="45" rows="5"><?php echo $row_recruitment['content'] ?></textarea></li>
        <li>
            <fieldset>
                <legend><h3>Options</h3></legend>
                <p>Show or Hide this article on your page.</p>
                <label><input <?php if($row_recruitment['hide/show']==0){ echo 'checked="checked"'; } ?> type="radio" name="AnHien" value="0" id="AnHien_0" />Hide</label>
                <label><input <?php if($row_recruitment['hide/show']==1){ echo 'checked="checked"'; } ?>  type="radio" name="AnHien" value="1" id="AnHien_1" />Show</label>
            </fieldset>
        </li>
        <li>
            <fieldset>
                <legend><h3>Language</h3></legend>
                <p>Choose contents language.</p>
                <select name="language" style="width: 100px">
                    <?php
                    $language=LanguageList();
                    while($row_language=mysql_fetch_array($language)){ ?>
                        <?php if($row_recruitment['language_id']==$row_language['language_id']){ ?>
                            <option selected="selected" value="<?php echo $row_language['language_id']; ?>"><?php echo $row_language['name']; ?></option>
                        <?php }else{ ?>
                            <option value="<?php echo $row_language['language_id']; ?>"><?php echo $row_language['name']; ?></option>
                        <?php } ?>
                    <?php } ?>
                </select>
            </fieldset>
        </li>
        <li><input class="button addnews" type="submit" name="btnAdd" id="btnAdd" value="Add Employee" /></li>
    </ul>
    <a href="index.php?p=cpanel" title="Back to Dashboard">&laquo; Back to Dashboard.</a>
</form>
<?php
}else{
    header("location:index.php?p=logincp");
}
?>